<template>
  <div>
    <van-nav-bar title="商品详情" left-arrow @click-left="onClickLeft" />
    <img v-lazy="detai.imageUrl" style="width:100%;height:3.5rem;" />
    <van-row type="flex" gutter="10">
      <van-col span="4">￥:{{detai.goodsPrice}}</van-col>
      <van-col span="8">市场价：{{detai.marketPrice}}</van-col>
      <van-col></van-col>
    </van-row>
    <van-divider />
    <van-row>
      <van-col>
        <van-tag color="#f2826a" plain>自营</van-tag>
        {{detai.goodsName}}
        {{detai.goodsNew}}
      </van-col>
    </van-row>
    <van-divider />
    <van-row type="flex" justify="space-between">
      <van-col span="2">分期</van-col>
      <van-col span="15">【最多可分12期】，每期手续费低至3元</van-col>
      <van-col span="6">. . .</van-col>
    </van-row>
    <van-row type="flex" justify="space-between">
      <van-col span="2">服务</van-col>
      <van-col span="15">*专业保真 *专业鉴定 *5天包退</van-col>
      <van-col span="6">. . .</van-col>
    </van-row>
    <van-divider />
    <van-divider />
    <van-row>商品信息</van-row>
    <van-divider />
    <van-row gutter="10">
      <van-col span="1"></van-col>
      <van-col span="23">
        <van-row>编号:{{detai.goodsNewId}}</van-row>
        <van-row>品牌：{{detai.brand}}</van-row>
        <van-row>尺寸：{{detai.goodsSize}}</van-row>
        <van-row>成色：{{detai.goodsNew}}</van-row>
      </van-col>
    </van-row>

    <van-goods-action>
      <van-goods-action-icon icon="chat-o" text="客服" @click="onClickIcon1" />
      <van-goods-action-icon icon="cart-o" text="购物车" @click="onClickIcon2" />
      <van-goods-action-button type="warning" text="加入购物车" @click="onClickButton" />
      <van-goods-action-button type="danger" text="立即购买" @click="onClickButton1" />
    </van-goods-action>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "details",
  data() {
    return {
      detai: ""
    };
  },
  mounted() {
    var _this = this;
    // console.log(this.$route.params.id)
    axios({
      url: "http://47.102.221.184:8083/secluxury/goods/getgoodsbyid",
      params: {
        goodsId: this.$route.params.id
      }
    }).then(data => {
      // console.log(data.data);
      this.detai = data.data;
      // console.log(this.detai);
      // var arr=[];
      // arr.push(this.detai)
      // localStorage.setItem('data',JSON.stringify(arr))
      // console.log(arr);

      // console.log(this.detai.goodsName);
    });
  },
  methods: {
    onClickLeft() {
      this.$router.push({ path: "/cart" });
    },
    onClickIcon1(){
      this.$router.push('/liaotian2')
    },
    onClickIcon2(){
      this.$router.push('/setsss')
    },
    onClickButton() {
      var a = JSON.parse(localStorage.getItem("token"));
      console.log(a[0]);
      axios({
        url: "http://47.102.221.184:8083/secluxury/shoppingcar/addShopping",
        params: {
          email: a[0],
          shoppingGoodsId: this.$route.params.id
        }
      }).then(data => {
        console.log(data);
        if (data.data != 0) {
          alert("加入成功");
          this.$router.push("/setsss");
        }
      });
    },
    onClickButton1() {
      this.$router.push({ path: "/payment" });
    }
  }
};
</script>

<style  scoped>
</style>